<?php
$this->breadcrumbs=array(
	Yii::t('base','Packages')=>array('admin'),
	Yii::t('base','Manage'),
);

$this->menu=array(
	array('label'=>'List Package', 'url'=>array('index')),
	array('label'=>'Create Package', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('package-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1><?php echo Yii::t('base','Manage Packages');?></h1>

<?php echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>');?>
<?php echo CHtml::link(Yii::t('base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php
	$flag = yii::app()->request->getParam('flag');
	if($flag == 'TV'){
?>
<a class="btn btn-small create" title="创建套餐" href="<?php echo Yii::app()->request->baseUrl; ?>/package/create?flag=TV">创建套餐</a>
<?php 
	}else{
?>
<a class="btn btn-small create" title="创建套餐" href="<?php echo Yii::app()->request->baseUrl; ?>/package/create">创建套餐</a>
<?php } ?>
<?php 

if(yii::app()->request->getParam('flag') == "TV"){
	$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'package-grid',
	'dataProvider'=>$model->search(),
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"'),'header'=>""),
	'pagerCssClass'=>'pagination',
	'cssFile'=>false,
	'template'=>'{items}{summary}{pager}',
	'columns'=>array(
		'package_id',
		'package_name',
		array('name'=>'package_content','value'=>'Package::model()->replacePackageContent($data->package_content)','headerHtmlOptions'=>array('style'=>'width:40%')),
		'package_price',
		array('name'=>'package_type','value'=>'Package::model()->showPackageType($data->package_id)'),
		array('name'=>'service_id','value'=>'Package::model()->showServiceName($data->package_id)'),
		array(
			'class'=>'CButtonColumn',
			'header'=>Yii::t('base','Operate'),
			'updateButtonImageUrl'=>array('class'=>'gicon-edit'),
			'updateButtonOptions'=>array('class'=>'btn btn-small'),
			'deleteButtonImageUrl'=>array('class'=>'gicon-edit'),
			'deleteButtonOptions'=>array('class'=>'btn btn-inverse btn-small'),
		),
	),
)); 
}else{
	
	$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'package-grid',
	'dataProvider'=>$model->search(),
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','firstPageLabel'=>'First','prevPageLabel' => 'Previous','nextPageLabel' => 'Next','lastPageLabel'=>'Last','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"'),'header'=>""),
	'pagerCssClass'=>'pagination pull-right',
	'cssFile'=>false,
	'columns'=>array(
		'package_id',
		'package_name',
		array('name'=>'package_content'),
		'package_price',
		array('name'=>'package_type','value'=>'Package::model()->showPackageType($data->package_id)'),
		array('name'=>'service_id','value'=>'Package::model()->showServiceName($data->package_id)'),
		array(
			'class'=>'CButtonColumn',
			'header'=>Yii::t('base','Operate'),
			'updateButtonImageUrl'=>array('class'=>'gicon-edit'),
			'updateButtonOptions'=>array('class'=>'btn btn-small'),
			'deleteButtonImageUrl'=>array('class'=>'gicon-edit'),
			'deleteButtonOptions'=>array('class'=>'btn btn-inverse btn-small'),
		),
	),
)); 
	
}








?>
